package com.example.lifecycledemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.example.lifecycledemo.databinding.Activity1Binding;

public class Activity1 extends AppCompatActivity {
    private final String TAG = "Activity1";
    private Activity1Binding binding;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = Activity1Binding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        Log.i(TAG,"onCreat() is call");

        //匿名内部类内容
        binding.button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Activity1.this,Activity2.class);
                startActivity(intent);
            }
        });
        }


    protected void onstart(){
        super.onStart();
        Log.i(TAG,"onstart() is call");
    }
    protected  void onPause() {
        super.onPause();
        Log.i(TAG,"onsPause() is call");
    }
    protected  void onResume() {
        super.onResume();

        Log.i(TAG, "onResume() is call");
    }

    protected  void onStop() {
        super.onStop();

        Log.i(TAG, "onStop() is call");
    }
    protected  void onDestroy() {
        super.onDestroy();

        Log.i(TAG, "onDestroy() is call");
    }
}